home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / fileutil / fileutils-3.16.tar.gz / fileutils-3.16.tar / fileutils-3.16 / aclocal.m4 < prev    next >
Text File  |  1997-01-26  |  27KB  |  943 lines

  1. dnl aclocal.m4 generated automatically by aclocal 1.1l
  2.  
  3. # Like AC_CONFIG_HEADER, but automatically create stamp file.
  4.  
  5. AC_DEFUN(AM_CONFIG_HEADER,
  6. [AC_PREREQ([2.12])
  7. AC_CONFIG_HEADER([$1])
  8. dnl When config.status generates a header, we must update the stamp-h file.
  9. dnl This file resides in the same directory as the config header
  10. dnl that is generated.  We must strip everything past the first ":",
  11. dnl and everything past the last "/".
  12. AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
  13. test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl
  14. changequote([,]))])
  15.  
  16. # Do all the work for Automake.  This macro actually does too much --
  17. # some checks are only needed if your package does certain things.
  18. # But this isn't really a big deal.
  19.  
  20. # serial 1
  21.  
  22. dnl Usage:
  23. dnl AM_INIT_AUTOMAKE(package,version)
  24.  
  25. AC_DEFUN(AM_INIT_AUTOMAKE,
  26. [AC_REQUIRE([AM_PROG_INSTALL])
  27. PACKAGE=[$1]
  28. AC_SUBST(PACKAGE)
  29. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
  30. VERSION=[$2]
  31. AC_SUBST(VERSION)
  32. AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
  33. AM_SANITY_CHECK
  34. AC_ARG_PROGRAM
  35. AC_PROG_MAKE_SET])
  36.  
  37.  
  38. # serial 1
  39.  
  40. AC_DEFUN(AM_PROG_INSTALL,
  41. [AC_REQUIRE([AC_PROG_INSTALL])
  42. test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
  43. AC_SUBST(INSTALL_SCRIPT)dnl
  44. ])
  45.  
  46. #
  47. # Check to make sure that the build environment is sane.
  48. #
  49.  
  50. AC_DEFUN(AM_SANITY_CHECK,
  51. [AC_MSG_CHECKING([whether build environment is sane])
  52. echo timestamp > conftestfile
  53. # Do this in a subshell so we don't clobber the current shell's
  54. # arguments.  FIXME: maybe try `-L' hack like GETLOADAVG test?
  55. if (set X `ls -t $srcdir/configure conftestfile`; test "[$]2" = conftestfile)
  56. then
  57.    # Ok.
  58.    :
  59. else
  60.    AC_MSG_ERROR([newly created file is older than distributed files!
  61. Check your system clock])
  62. fi
  63. rm -f conftest*
  64. AC_MSG_RESULT(yes)])
  65.  
  66. # Add --enable-maintainer-mode option to configure.
  67. # From Jim Meyering
  68.  
  69. # serial 1
  70.  
  71. AC_DEFUN(AM_MAINTAINER_MODE,
  72. [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
  73.   dnl maintainer-mode is disabled by default
  74.   AC_ARG_ENABLE(maintainer-mode,
  75. [  --enable-maintainer-mode enable make rules and dependencies not useful
  76.                           (and sometimes confusing) to the casual installer],
  77.       USE_MAINTAINER_MODE=$enableval,
  78.       USE_MAINTAINER_MODE=no)
  79.   AC_MSG_RESULT($USE_MAINTAINER_MODE)
  80.   if test $USE_MAINTAINER_MODE = yes; then
  81.     MAINT=
  82.   else
  83.     MAINT='#M#'
  84.   fi
  85.   AC_SUBST(MAINT)dnl
  86. ]
  87. )
  88.  
  89.  
  90. # serial 1
  91.  
  92. # The idea is to distribute rx.[hc] and regex.[hc] together, for a while.
  93. # The WITH_REGEX symbol (which should also be documented in acconfig.h)
  94. # is used to decide which of regex.h or rx.h should be included in the
  95. # application.  If `./configure --with-regex' is given (the default), the
  96. # package will use gawk's regex.  If `./configure --without-regex', a
  97. # check is made to see if rx is already installed, as with newer Linux'es.
  98. # If not found, the package will use the rx from the distribution.
  99. # If found, the package will use the system's rx which, on Linux at least,
  100. # will result in a smaller executable file.
  101.  
  102. AC_DEFUN(AM_WITH_REGEX,
  103. [AC_MSG_CHECKING(which of GNU rx or gawk's regex is wanted)
  104. AC_ARG_WITH(regex,
  105. [  --without-regex         use GNU rx in lieu of gawk's regex for matching],
  106. [test "$withval" = yes && am_with_regex=1],
  107. [am_with_regex=1])
  108. if test -n "$am_with_regex"; then
  109.   AC_MSG_RESULT(regex)
  110.   AC_DEFINE(WITH_REGEX)
  111.   AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex,
  112.     AC_TRY_LINK([], [extern int re_max_failures; re_max_failures = 1],
  113.         am_cv_gnu_regex=yes, am_cv_gnu_regex=no))
  114.   if test $am_cv_gnu_regex = no; then
  115.     LIBOBJS="$LIBOBJS regex.o"
  116.   fi
  117. else
  118.   AC_MSG_RESULT(rx)
  119.   AC_CHECK_FUNC(re_rx_search, , [LIBOBJS="$LIBOBJS rx.o"])
  120. fi
  121. AC_SUBST(LIBOBJS)dnl
  122. ])
  123.  
  124.  
  125. # serial 1
  126.  
  127. AC_DEFUN(AM_C_PROTOTYPES,
  128. [AC_REQUIRE([AM_PROG_CC_STDC])
  129. AC_BEFORE([$0], [AC_C_INLINE])
  130. AC_MSG_CHECKING([for function prototypes])
  131. if test "$am_cv_prog_cc_stdc" != no; then
  132.   AC_MSG_RESULT(yes)
  133.   AC_DEFINE(PROTOTYPES)
  134.   U= ANSI2KNR=
  135. else
  136.   AC_MSG_RESULT(no)
  137.   U=_ ANSI2KNR=./ansi2knr
  138.   # Ensure some checks needed by ansi2knr itself.
  139.   AC_HEADER_STDC
  140.   AC_CHECK_HEADERS(string.h)
  141. fi
  142. AC_SUBST(U)dnl
  143. AC_SUBST(ANSI2KNR)dnl
  144. ])
  145.  
  146.  
  147. # serial 1
  148.  
  149. # @defmac AC_PROG_CC_STDC
  150. # @maindex PROG_CC_STDC
  151. # @ovindex CC
  152. # If the C compiler in not in ANSI C mode by default, try to add an option
  153. # to output variable @code{CC} to make it so.  This macro tries various
  154. # options that select ANSI C on some system or another.  It considers the
  155. # compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
  156. # handles function prototypes correctly.
  157. #
  158. # If you use this macro, you should check after calling it whether the C
  159. # compiler has been set to accept ANSI C; if not, the shell variable
  160. # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
  161. # code in ANSI C, you can make an un-ANSIfied copy of it by using the
  162. # program @code{ansi2knr}, which comes with Ghostscript.
  163. # @end defmac
  164.  
  165. AC_DEFUN(AM_PROG_CC_STDC,
  166. [AC_REQUIRE([AC_PROG_CC])
  167. AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
  168. AC_CACHE_VAL(am_cv_prog_cc_stdc,
  169. [am_cv_prog_cc_stdc=no
  170. ac_save_CC="$CC"
  171. # Don't try gcc -ansi; that turns off useful extensions and
  172. # breaks some systems' header files.
  173. # AIX            -qlanglvl=ansi
  174. # Ultrix and OSF/1    -std1
  175. # HP-UX            -Aa -D_HPUX_SOURCE
  176. # SVR4            -Xc -D__EXTENSIONS__
  177. for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
  178. do
  179.   CC="$ac_save_CC $ac_arg"
  180.   AC_TRY_COMPILE(
  181. [#if !defined(__STDC__) || __STDC__ != 1
  182. choke me
  183. #endif
  184. /* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
  185. #ifdef _SEQUENT_
  186. # include <sys/types.h>
  187. # include <sys/stat.h>
  188. #endif
  189. ], [
  190. int test (int i, double x);
  191. struct s1 {int (*f) (int a);};
  192. struct s2 {int (*f) (double a);};],
  193. [am_cv_prog_cc_stdc="$ac_arg"; break])
  194. done
  195. CC="$ac_save_CC"
  196. ])
  197. AC_MSG_RESULT($am_cv_prog_cc_stdc)
  198. case "x$am_cv_prog_cc_stdc" in
  199.   x|xno) ;;
  200.   *) CC="$CC $am_cv_prog_cc_stdc" ;;
  201. esac
  202. ])
  203.  
  204. #serial 1
  205.  
  206. dnl From Jim Meyering.
  207. dnl If you use this macro in a package, you should
  208. dnl add the following two lines to acconfig.h:
  209. dnl   /* Define to rpl_mktime if the replacement function should be used.  */
  210. dnl   #undef mktime
  211. dnl
  212. AC_DEFUN(jm_FUNC_MKTIME,
  213. [AC_REQUIRE([AM_FUNC_MKTIME])dnl
  214.  if test $am_cv_func_working_mktime = no; then
  215.    AC_DEFINE_UNQUOTED(mktime, rpl_mktime)
  216.  fi
  217. ])
  218.  
  219. #serial 2
  220.  
  221. dnl From Jim Meyering.
  222. dnl FIXME: this should migrate into libit.
  223.  
  224. AC_DEFUN(AM_FUNC_MKTIME,
  225. [AC_REQUIRE([AC_HEADER_TIME])dnl
  226.  AC_CHECK_HEADERS(sys/time.h)
  227.  AC_CACHE_CHECK([for working mktime], am_cv_func_working_mktime,
  228.   [AC_TRY_RUN(
  229. changequote(<<, >>)dnl
  230. <</* Test program from Paul Eggert (eggert@twinsun.com)
  231.    and Tony Leneis (tony@plaza.ds.adp.com).  */
  232. #if TIME_WITH_SYS_TIME
  233. # include <sys/time.h>
  234. # include <time.h>
  235. #else
  236. # if HAVE_SYS_TIME_H
  237. #  include <sys/time.h>
  238. # else
  239. #  include <time.h>
  240. # endif
  241. #endif
  242.  
  243. static time_t time_t_max;
  244.  
  245. /* Values we'll use to set the TZ environment variable.  */
  246. static const char *const tz_strings[] = {
  247.   NULL, "GMT0", "JST-9", "EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
  248. };
  249. #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
  250.  
  251. static void
  252. mktime_test (now)
  253.      time_t now;
  254. {
  255.   if (mktime (localtime (&now)) != now)
  256.     exit (1);
  257.   now = time_t_max - now;
  258.   if (mktime (localtime (&now)) != now)
  259.     exit (1);
  260. }
  261.  
  262. int
  263. main ()
  264. {
  265.   time_t t, delta;
  266.   int i;
  267.  
  268.   for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
  269.     continue;
  270.   time_t_max--;
  271.   delta = time_t_max / 997; /* a suitable prime number */
  272.   for (i = 0; i < N_STRINGS; i++)
  273.     {
  274.       if (tz_strings[i])
  275.     putenv (tz_strings[i]);
  276.  
  277.       for (t = 0; t <= time_t_max - delta; t += delta)
  278.     mktime_test (t);
  279.       mktime_test ((time_t) 60 * 60);
  280.       mktime_test ((time_t) 60 * 60 * 24);
  281.     }
  282.   exit (0);
  283. }
  284.           >>,
  285. changequote([, ])dnl
  286.          am_cv_func_working_mktime=yes, am_cv_func_working_mktime=no,
  287.          dnl When crosscompiling, assume mktime is missing or broken.
  288.          am_cv_func_working_mktime=no)
  289.   ])
  290.   if test $am_cv_func_working_mktime = no; then
  291.     LIBOBJS="$LIBOBJS mktime.o"
  292.   fi
  293. ])
  294.  
  295. #serial 3
  296.  
  297. dnl From Jim Meyering.
  298. dnl If you use this macro in a package, you should
  299. dnl add the following two lines to acconfig.h:
  300. dnl   /* Define to gnu_strftime if the replacement function should be used.  */
  301. dnl   #undef strftime
  302. dnl
  303. AC_DEFUN(jm_FUNC_GNU_STRFTIME,
  304. [AC_REQUIRE([AC_HEADER_TIME])dnl
  305.  AC_REQUIRE([AC_C_CONST])dnl
  306.  AC_REQUIRE([AC_HEADER_STDC])dnl
  307.  AC_CHECK_HEADERS(sys/time.h)
  308.  AC_CACHE_CHECK([for working GNU strftime], jm_cv_func_working_gnu_strftime,
  309.   [AC_TRY_RUN(
  310. changequote(<<, >>)dnl
  311. << /* Ulrich Drepper provided parts of the test program.  */
  312. #if STDC_HEADERS
  313. # include <stdlib.h>
  314. #endif
  315.  
  316. #if TIME_WITH_SYS_TIME
  317. # include <sys/time.h>
  318. # include <time.h>
  319. #else
  320. # if HAVE_SYS_TIME_H
  321. #  include <sys/time.h>
  322. # else
  323. #  include <time.h>
  324. # endif
  325. #endif
  326.  
  327. static int
  328. compare (const char *fmt, const struct tm *tm, const char *expected)
  329. {
  330.   char buf[99];
  331.   strftime (buf, 99, fmt, tm);
  332.   if (strcmp (buf, expected))
  333.     {
  334. #ifdef SHOW_FAILURES
  335.       printf ("fmt: \"%s\", expected \"%s\", got \"%s\"\n",
  336.           fmt, expected, buf);
  337. #endif
  338.       return 1;
  339.     }
  340.   return 0;
  341. }
  342.  
  343. int
  344. main ()
  345. {
  346.   int n_fail = 0;
  347.   struct tm *tm;
  348.   time_t t = 738367; /* Fri Jan  9 13:06:07 1970 */
  349.   tm = gmtime (&t);
  350.  
  351.   /* This is necessary to make strftime give consistent zone strings and
  352.      e.g., seconds since the epoch (%s).  */
  353.   putenv ("TZ=GMT0");
  354.  
  355. #undef CMP
  356. #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
  357.  
  358.   CMP ("%-m", "1");        /* GNU */
  359.   CMP ("%A", "Friday");
  360.   CMP ("%^A", "FRIDAY");    /* The ^ is a GNU extension.  */
  361.   CMP ("%B", "January");
  362.   CMP ("%^B", "JANUARY");
  363.   CMP ("%C", "19");        /* POSIX.2 */
  364.   CMP ("%D", "01/09/70");    /* POSIX.2 */
  365.   CMP ("%G", "1970");        /* GNU */
  366.   CMP ("%H", "13");
  367.   CMP ("%I", "01");
  368.   CMP ("%M", "06");
  369.   CMP ("%M", "06");
  370.   CMP ("%R", "13:06");        /* POSIX.2 */
  371.   CMP ("%S", "07");
  372.   CMP ("%T", "13:06:07");    /* POSIX.2 */
  373.   CMP ("%U", "01");
  374.   CMP ("%V", "02");
  375.   CMP ("%W", "01");
  376.   CMP ("%X", "13:06:07");
  377.   CMP ("%Y", "1970");
  378.   CMP ("%Z", "GMT");
  379.   CMP ("%_m", " 1");        /* GNU */
  380.   CMP ("%a", "Fri");
  381.   CMP ("%^a", "FRI");
  382.   CMP ("%b", "Jan");
  383.   CMP ("%^b", "JAN");
  384.   CMP ("%c", "Fri Jan  9 13:06:07 1970");
  385.   CMP ("%^c", "FRI JAN  9 13:06:07 1970");
  386.   CMP ("%d", "09");
  387.   CMP ("%e", " 9");        /* POSIX.2 */
  388.   CMP ("%g", "70");        /* GNU */
  389.   CMP ("%h", "Jan");        /* POSIX.2 */
  390.   CMP ("%^h", "JAN");
  391.   CMP ("%j", "009");
  392.   CMP ("%k", "13");        /* GNU */
  393.   CMP ("%l", " 1");        /* GNU */
  394.   CMP ("%m", "01");
  395.   CMP ("%n", "\n");        /* POSIX.2 */
  396.   CMP ("%p", "PM");
  397.   CMP ("%r", "01:06:07 PM");    /* POSIX.2 */
  398.   CMP ("%s", "738367");        /* GNU */
  399.   CMP ("%t", "\t");        /* POSIX.2 */
  400.   CMP ("%u", "5");        /* POSIX.2 */
  401.   CMP ("%w", "5");
  402.   CMP ("%x", "01/09/70");
  403.   CMP ("%y", "70");
  404.   CMP ("%z", "+0000");        /* GNU */
  405.  
  406.   exit (n_fail ? 1 : 0);
  407. }
  408.           >>,
  409. changequote([, ])dnl
  410.          jm_cv_func_working_gnu_strftime=yes,
  411.              jm_cv_func_working_gnu_strftime=no,
  412.          dnl When crosscompiling, assume strftime is missing or broken.
  413.          jm_cv_func_working_gnu_strftime=no)
  414.   ])
  415.   if test $jm_cv_func_working_gnu_strftime = no; then
  416.     LIBOBJS="$LIBOBJS strftime.o"
  417.     AC_DEFINE_UNQUOTED(strftime, gnu_strftime)
  418.   fi
  419. ])
  420.  
  421. #serial 1
  422.  
  423. dnl See if there's a working, system-supplied version of the getline function.
  424. dnl We can't just to AC_REPLACE_FUNCS(getline) because some systems
  425. dnl have a function by that name in -linet that doesn't have anything
  426. dnl to do with the function we need.
  427. AC_DEFUN(AM_FUNC_GETLINE,
  428. [dnl
  429.   am_getline_needs_run_time_check=no
  430.   am_cv_func_working_getline=yes
  431.   AC_CHECK_FUNC(getline,
  432.         dnl Found it in some library.  Verify that it works.
  433.         am_getline_needs_run_time_check=yes,
  434.         am_cv_func_working_getline=no)
  435.   if test $am_getline_needs_run_time_check = yes; then
  436.     AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline,
  437.     [echo fooN |tr -d '\012'|tr N '\012' > conftestdata
  438.     AC_TRY_RUN([
  439. #    include <stdio.h>
  440. #    include <sys/types.h>
  441. #    if HAVE_STRING_H
  442. #     include <string.h>
  443. #    endif
  444.     int main ()
  445.     { /* Based on a test program from Karl Heuer.  */
  446.       char *line = NULL;
  447.       size_t siz = 0;
  448.       int len;
  449.       FILE *in = fopen ("./conftestdata", "r");
  450.       if (!in)
  451.     return 1;
  452.       len = getline (&line, &siz, in);
  453.       exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1);
  454.     }
  455.     ], am_cv_func_working_getline=yes dnl The library version works.
  456.     , am_cv_func_working_getline=no dnl The library version does NOT work.
  457.     , am_cv_func_working_getline=no dnl We're cross compiling.
  458.     )])
  459.   fi
  460.  
  461.   if test $am_cv_func_working_getline = no; then
  462.     LIBOBJS="$LIBOBJS getline.o"
  463.     AC_SUBST(LIBOBJS)dnl
  464.   fi
  465. ])
  466.  
  467. dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
  468. dnl FIXME: Migrate into libit
  469.  
  470. AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
  471. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  472.  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  473.               am_cv_lib_error_at_line=yes,
  474.           am_cv_lib_error_at_line=no)])
  475.  if test $am_cv_lib_error_at_line = no; then
  476.    LIBOBJS="$LIBOBJS error.o"
  477.  fi
  478.  AC_SUBST(LIBOBJS)dnl
  479. ])
  480.  
  481. dnl From Jim Meyering.
  482. dnl FIXME: migrate into libit.
  483.  
  484. AC_DEFUN(AM_FUNC_OBSTACK,
  485. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  486.  [AC_TRY_LINK([#include "obstack.h"],
  487.           [struct obstack *mem;obstack_free(mem,(char *) 0)],
  488.           am_cv_func_obstack=yes,
  489.           am_cv_func_obstack=no)])
  490.  if test $am_cv_func_obstack = yes; then
  491.    AC_DEFINE(HAVE_OBSTACK)
  492.  else
  493.    LIBOBJS="$LIBOBJS obstack.o"
  494.  fi
  495. ])
  496.  
  497. dnl From Jim Meyering.
  498.  
  499. # serial 1
  500.  
  501. AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
  502. [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
  503.  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
  504.             am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
  505.   [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
  506.  
  507.   gwinsz_in_termios_h=no
  508.   if test $am_cv_sys_posix_termios = yes; then
  509.     AC_EGREP_CPP([yes],
  510.     [#include <sys/types.h>
  511. #     include <termios.h>
  512. #     ifdef TIOCGWINSZ
  513.         yes
  514. #     endif
  515.     ], gwinsz_in_termios_h=yes)
  516.   fi
  517.  
  518.   if test $gwinsz_in_termios_h = no; then
  519.     AC_EGREP_CPP([yes],
  520.     [#include <sys/types.h>
  521. #     include <sys/ioctl.h>
  522. #     ifdef TIOCGWINSZ
  523.         yes
  524. #     endif
  525.     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
  526.   fi
  527.   ])
  528.   if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
  529.     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
  530.   fi
  531. ])
  532.  
  533. dnl From Jim Meyering.
  534.  
  535. # serial 1
  536.  
  537. AC_DEFUN(AM_SYS_POSIX_TERMIOS,
  538. [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
  539.   [AC_TRY_LINK([#include <sys/types.h>
  540. #include <unistd.h>
  541. #include <termios.h>],
  542.   [/* SunOS 4.0.3 has termios.h but not the library calls.  */
  543.    tcgetattr(0, 0);],
  544.   am_cv_sys_posix_termios=yes,
  545.   am_cv_sys_posix_termios=no)])
  546. ])
  547.  
  548. #serial 2
  549.  
  550. dnl From Jim Meyering.
  551. dnl If you use this macro in a package, you should
  552. dnl add the following two lines to acconfig.h:
  553. dnl  /* Define to rpl_getgroups if the replacement function should be used.  */
  554. dnl  #undef getgroups
  555. dnl
  556. dnl Invoking code should check $GETGROUPS_LIB something like this:
  557. dnl  jm_FUNC_GETGROUPS
  558. dnl  test -n "$GETGROUPS_LIB" && LIBS="$GETGROUPS_LIB $LIBS"
  559. dnl
  560.  
  561. AC_DEFUN(jm_FUNC_GETGROUPS,
  562. [AC_REQUIRE([AC_TYPE_GETGROUPS])dnl
  563.  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  564.  AC_CHECK_FUNCS(getgroups)
  565.  
  566.  # If we don't yet have getgroups, see if it's in -lbsd.
  567.  # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1.
  568.  if test $ac_cv_func_getgroups = no; then
  569.    jm_cv_sys_getgroups_saved_lib="$LIBS"
  570.    AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd])
  571.    LIBS="$jm_cv_sys_getgroups_saved_lib"
  572.  fi
  573.  
  574.  # Run the program to test the functionality of the system-supplied
  575.  # getgroups function only if there is such a function.
  576.  if test $ac_cv_func_getgroups = yes; then
  577.    AC_CACHE_CHECK([for working getgroups], jm_cv_func_working_getgroups,
  578.     [AC_TRY_RUN([
  579.       int
  580.       main ()
  581.       {
  582.     /* On Ultrix 4.3, getgroups (0, 0) always fails.  */
  583.     exit (getgroups (0, 0) == -1 ? 1 : 0);
  584.       }
  585.         ],
  586.            jm_cv_func_working_getgroups=yes,
  587.            jm_cv_func_working_getgroups=no,
  588.            dnl When crosscompiling, assume getgroups is broken.
  589.            jm_cv_func_working_getgroups=no)
  590.     ])
  591.     if test $jm_cv_func_working_getgroups = no; then
  592.       LIBOBJS="$LIBOBJS getgroups.o"
  593.       AC_DEFINE_UNQUOTED(getgroups, rpl_getgroups)
  594.     fi
  595.   fi
  596. ])
  597.  
  598. # Macro to add for using GNU gettext.
  599. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  600.  
  601. # serial 1
  602.  
  603. AC_DEFUN(AM_WITH_NLS,
  604.   [AC_MSG_CHECKING([whether NLS is requested])
  605.     dnl Default is enabled NLS
  606.     AC_ARG_ENABLE(nls,
  607.       [  --disable-nls           do not use Native Language Support],
  608.       USE_NLS=$enableval, USE_NLS=yes)
  609.     AC_MSG_RESULT($USE_NLS)
  610.     AC_SUBST(USE_NLS)
  611.  
  612.     USE_INCLUDED_LIBINTL=no
  613.  
  614.     dnl If we use NLS figure out what method
  615.     if test "$USE_NLS" = "yes"; then
  616.       AC_DEFINE(ENABLE_NLS)
  617.       AC_MSG_CHECKING([whether included gettext is requested])
  618.       AC_ARG_WITH(included-gettext,
  619.         [  --with-included-gettext use the GNU gettext library included here],
  620.         nls_cv_force_use_gnu_gettext=$withval,
  621.         nls_cv_force_use_gnu_gettext=no)
  622.       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  623.  
  624.       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  625.       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  626.         dnl User does not insist on using GNU NLS library.  Figure out what
  627.         dnl to use.  If gettext or catgets are available (in this order) we
  628.         dnl use this.  Else we have to fall back to GNU NLS library.
  629.     dnl catgets is only used if permitted by option --with-catgets.
  630.     nls_cv_header_intl=
  631.     nls_cv_header_libgt=
  632.     CATOBJEXT=NONE
  633.  
  634.     AC_CHECK_HEADER(libintl.h,
  635.       [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
  636.         [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
  637.            gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
  638.  
  639.        if test "$gt_cv_func_gettext_libc" != "yes"; then
  640.          AC_CHECK_LIB(intl, bindtextdomain,
  641.            [AC_CACHE_CHECK([for gettext in libintl],
  642.          gt_cv_func_gettext_libintl,
  643.          [AC_TRY_LINK([], [return (int) gettext ("")],
  644.          gt_cv_func_gettext_libintl=yes,
  645.          gt_cv_func_gettext_libintl=no)])])
  646.        fi
  647.  
  648.        if test "$gt_cv_func_gettext_libc" = "yes" \
  649.           || test "$gt_cv_func_gettext_libintl" = "yes"; then
  650.           AC_DEFINE(HAVE_GETTEXT)
  651.           AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  652.         [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
  653.           if test "$MSGFMT" != "no"; then
  654.         AC_CHECK_FUNCS(dcgettext)
  655.         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  656.         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  657.           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  658.         AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
  659.                    return _nl_msg_cat_cntr],
  660.           [CATOBJEXT=.gmo
  661.            DATADIRNAME=share],
  662.           [CATOBJEXT=.mo
  663.            DATADIRNAME=lib])
  664.         INSTOBJEXT=.mo
  665.           fi
  666.         fi
  667.     ])
  668.  
  669.         if test "$CATOBJEXT" = "NONE"; then
  670.       AC_MSG_CHECKING([whether catgets can be used])
  671.       AC_ARG_WITH(catgets,
  672.         [  --with-catgets          use catgets functions if available],
  673.         nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
  674.       AC_MSG_RESULT($nls_cv_use_catgets)
  675.  
  676.       if test "$nls_cv_use_catgets" = "yes"; then
  677.         dnl No gettext in C library.  Try catgets next.
  678.         AC_CHECK_LIB(i, main)
  679.         AC_CHECK_FUNC(catgets,
  680.           [AC_DEFINE(HAVE_CATGETS)
  681.            INTLOBJS="\$(CATOBJS)"
  682.            AC_PATH_PROG(GENCAT, gencat, no)dnl
  683.            if test "$GENCAT" != "no"; then
  684.          AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
  685.          if test "$GMSGFMT" = "no"; then
  686.            AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
  687.             [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
  688.          fi
  689.          AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  690.            [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  691.          USE_INCLUDED_LIBINTL=yes
  692.          CATOBJEXT=.cat
  693.          INSTOBJEXT=.cat
  694.          DATADIRNAME=lib
  695.          INTLDEPS="../intl/libintl.a"
  696.          INTLLIBS=$INTLDEPS
  697.          LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  698.          nls_cv_header_intl=intl/libintl.h
  699.          nls_cv_header_libgt=intl/libgettext.h
  700.            fi])
  701.       fi
  702.         fi
  703.  
  704.         if test "$CATOBJEXT" = "NONE"; then
  705.       dnl Neither gettext nor catgets in included in the C library.
  706.       dnl Fall back on GNU gettext library.
  707.       nls_cv_use_gnu_gettext=yes
  708.         fi
  709.       fi
  710.  
  711.       if test "$nls_cv_use_gnu_gettext" = "yes"; then
  712.         dnl Mark actions used to generate GNU NLS library.
  713.         INTLOBJS="\$(GETTOBJS)"
  714.         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  715.       [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
  716.         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  717.         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  718.       [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  719.         AC_SUBST(MSGFMT)
  720.     USE_INCLUDED_LIBINTL=yes
  721.         CATOBJEXT=.gmo
  722.         INSTOBJEXT=.mo
  723.         DATADIRNAME=share
  724.     INTLDEPS="../intl/libintl.a"
  725.     INTLLIBS=$INTLDEPS
  726.     LIBS=`echo $LIBS | sed -e 's/-lintl//'`
  727.         nls_cv_header_intl=intl/libintl.h
  728.         nls_cv_header_libgt=intl/libgettext.h
  729.       fi
  730.  
  731.       dnl Test whether we really found GNU xgettext.
  732.       if test "$XGETTEXT" != ":"; then
  733.     dnl If it is no GNU xgettext we define it as : so that the
  734.     dnl Makefiles still can work.
  735.     if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  736.       : ;
  737.     else
  738.       AC_MSG_RESULT(
  739.         [found xgettext programs is not GNU xgettext; ignore it])
  740.       XGETTEXT=":"
  741.     fi
  742.       fi
  743.  
  744.       # We need to process the po/ directory.
  745.       POSUB=po
  746.     else
  747.       DATADIRNAME=share
  748.       nls_cv_header_intl=intl/libintl.h
  749.       nls_cv_header_libgt=intl/libgettext.h
  750.     fi
  751.  
  752.     # If this is used in GNU gettext we have to set USE_NLS to `yes'
  753.     # because some of the sources are only built for this goal.
  754.     if test "$PACKAGE" = gettext; then
  755.       USE_NLS=yes
  756.       USE_INCLUDED_LIBINTL=yes
  757.     fi
  758.  
  759.     dnl These rules are solely for the distribution goal.  While doing this
  760.     dnl we only have to keep exactly one list of the available catalogs
  761.     dnl in configure.in.
  762.     for lang in $ALL_LINGUAS; do
  763.       GMOFILES="$GMOFILES $lang.gmo"
  764.       POFILES="$POFILES $lang.po"
  765.     done
  766.  
  767.     dnl Make all variables we use known to autoconf.
  768.     AC_SUBST(USE_INCLUDED_LIBINTL)
  769.     AC_SUBST(CATALOGS)
  770.     AC_SUBST(CATOBJEXT)
  771.     AC_SUBST(DATADIRNAME)
  772.     AC_SUBST(GMOFILES)
  773.     AC_SUBST(INSTOBJEXT)
  774.     AC_SUBST(INTLDEPS)
  775.     AC_SUBST(INTLLIBS)
  776.     AC_SUBST(INTLOBJS)
  777.     AC_SUBST(POFILES)
  778.     AC_SUBST(POSUB)
  779.   ])
  780.  
  781. AC_DEFUN(AM_GNU_GETTEXT,
  782.   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  783.    AC_REQUIRE([AC_PROG_CC])dnl
  784.    AC_REQUIRE([AC_PROG_RANLIB])dnl
  785.    AC_REQUIRE([AC_HEADER_STDC])dnl
  786.    AC_REQUIRE([AC_C_CONST])dnl
  787.    AC_REQUIRE([AC_C_INLINE])dnl
  788.    AC_REQUIRE([AC_TYPE_OFF_T])dnl
  789.    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  790.    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  791.    AC_REQUIRE([AC_FUNC_MMAP])dnl
  792.  
  793.    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
  794. unistd.h values.h])
  795.    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
  796. __argz_count __argz_stringify __argz_next])
  797.  
  798.    if test "${ac_cv_func_stpcpy+set}" != "set"; then
  799.      AC_CHECK_FUNCS(stpcpy)
  800.    fi
  801.    if test "${ac_cv_func_stpcpy}" = "yes"; then
  802.      AC_DEFINE(HAVE_STPCPY)
  803.    fi
  804.  
  805.    AM_LC_MESSAGES
  806.    AM_WITH_NLS
  807.  
  808.    if test "x$CATOBJEXT" != "x"; then
  809.      if test "x$ALL_LINGUAS" = "x"; then
  810.        LINGUAS=
  811.      else
  812.        AC_MSG_CHECKING(for catalogs to be installed)
  813.        NEW_LINGUAS=
  814.        for lang in ${LINGUAS=$ALL_LINGUAS}; do
  815.          case "$ALL_LINGUAS" in
  816.           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  817.          esac
  818.        done
  819.        LINGUAS=$NEW_LINGUAS
  820.        AC_MSG_RESULT($LINGUAS)
  821.      fi
  822.  
  823.      dnl Construct list of names of catalog files to be constructed.
  824.      if test -n "$LINGUAS"; then
  825.        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  826.      fi
  827.    fi
  828.  
  829.    dnl Determine which catalog format we have (if any is needed)
  830.    dnl For now we know about two different formats:
  831.    dnl   Linux libc-5 and the normal X/Open format
  832.    test -d intl || mkdir intl
  833.    if test "$CATOBJEXT" = ".cat"; then
  834.      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
  835.  
  836.      dnl Transform the SED scripts while copying because some dumb SEDs
  837.      dnl cannot handle comments.
  838.      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
  839.    fi
  840.    dnl po2tbl.sed is always needed.
  841.    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
  842.      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
  843.  
  844.    dnl In the intl/Makefile.in we have a special dependency which makes
  845.    dnl only sense for gettext.  We comment this out for non-gettext
  846.    dnl packages.
  847.    if test "$PACKAGE" = "gettext"; then
  848.      GT_NO="#NO#"
  849.      GT_YES=
  850.    else
  851.      GT_NO=
  852.      GT_YES="#YES#"
  853.    fi
  854.    AC_SUBST(GT_NO)
  855.    AC_SUBST(GT_YES)
  856.  
  857.    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  858.    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
  859.    dnl Try to locate is.
  860.    MKINSTALLDIRS=
  861.    if test $ac_aux_dir; then
  862.      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
  863.    fi
  864.    if test -z $MKINSTALLDIRS; then
  865.      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
  866.    fi
  867.    AC_SUBST(MKINSTALLDIRS)
  868.  
  869.    dnl Generate list of files to be processed by xgettext which will
  870.    dnl be included in po/Makefile.
  871.    test -d po || mkdir po
  872.    if test "x$srcdir" != "x."; then
  873.      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
  874.        posrcprefix="$srcdir/"
  875.      else
  876.        posrcprefix="../$srcdir/"
  877.      fi
  878.    else
  879.      posrcprefix="../"
  880.    fi
  881.    sed -e "/^#/d" -e "/^\$/d" -e "s,.*,    $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
  882.     < $srcdir/po/POTFILES.in > po/POTFILES
  883.   ])
  884.  
  885. # Search path for a program which passes the given test.
  886. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  887.  
  888. # serial 1
  889.  
  890. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  891. dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  892. AC_DEFUN(AM_PATH_PROG_WITH_TEST,
  893. [# Extract the first word of "$2", so it can be a program name with args.
  894. set dummy $2; ac_word=[$]2
  895. AC_MSG_CHECKING([for $ac_word])
  896. AC_CACHE_VAL(ac_cv_path_$1,
  897. [case "[$]$1" in
  898.   /*)
  899.   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  900.   ;;
  901.   *)
  902.   IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  903.   for ac_dir in ifelse([$5], , $PATH, [$5]); do
  904.     test -z "$ac_dir" && ac_dir=.
  905.     if test -f $ac_dir/$ac_word; then
  906.       if [$3]; then
  907.     ac_cv_path_$1="$ac_dir/$ac_word"
  908.     break
  909.       fi
  910.     fi
  911.   done
  912.   IFS="$ac_save_ifs"
  913. dnl If no 4th arg is given, leave the cache variable unset,
  914. dnl so AC_PATH_PROGS will keep looking.
  915. ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  916. ])dnl
  917.   ;;
  918. esac])dnl
  919. $1="$ac_cv_path_$1"
  920. if test -n "[$]$1"; then
  921.   AC_MSG_RESULT([$]$1)
  922. else
  923.   AC_MSG_RESULT(no)
  924. fi
  925. AC_SUBST($1)dnl
  926. ])
  927.  
  928. # Check whether LC_MESSAGES is available in <locale.h>.
  929. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  930.  
  931. # serial 1
  932.  
  933. AC_DEFUN(AM_LC_MESSAGES,
  934.   [if test $ac_cv_header_locale_h = yes; then
  935.     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  936.       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  937.        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  938.     if test $am_cv_val_LC_MESSAGES = yes; then
  939.       AC_DEFINE(HAVE_LC_MESSAGES)
  940.     fi
  941.   fi])
  942.  
  943.